package cn.echo.consul.manager.config;

import com.ecwid.consul.v1.ConsulClient;
import com.ecwid.consul.v1.ConsulRawClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * Consul服务配置
 */
@Component
public class ConsulConfig {

    @Value("${manager.consul.host}")
    private String host;

    @Value("${manager.consul.port}")
    private Integer port;

    @Bean
    public ConsulClient consulClient() {
        ConsulRawClient consulRawClient = new ConsulRawClient(host, port);
        return new ConsulClient(consulRawClient);
    }
}
